<?php

	include("includes/connect.php");

?>

<script type="text/javascript">
	$(document).ready(function(){
		$("a[id^='edit']").click(function() {
			
			event.preventDefault();

			$('<div>').dialog2({
				autoOpen: true,
				title: "บันทึกข้อมูล",
				content: "modal_test.php",
				id: "modal-menus-edit"
			});

		});

		$('#example').dataTable({
			
			
		});


				    
	});
</script>

<a href="index.php?pages=editBudget" role="button" class="btn btn-primary">&nbsp;&nbsp;&nbsp;<i class="icon-plus icon-white"></i>&nbsp;เพิ่มฎีกาใหม่&nbsp;&nbsp;&nbsp;</a><br><br>

<div id="ikob">
	<table id="example" class="table table-bordered" width="100%" >
		<caption><br></caption>
		<thead>
			<tr>
				<th>#</th>
				<th>ชื่อ - นามสกุล</th>
				<th>อายุ</th>
				<th>action</th>
			</tr>
		</thead>
		<tbody>
		<?php
			$sql = "SELECT * FROM tblTest";
			$query = mysql_query( $sql );
			$array = array();
			while ($row1 = mysql_fetch_object( $query )) {
				$array[] = $row1;
			}
			$rows = $array;
			for ($i=0, $n=count( $rows ); $i < $n; $i++) {
				$row = &$rows[$i];
		?>
							
			<tr>
			  <td><?php echo $row->id; ?></td>
			  <td><?php echo $row->name; ?></td>
			  <td><?php echo $row->age; ?></td>
			  <td>
			  <a href="#" id="edit<?php echo $row->id; ?>"><i class="icon-edit"></i>แก้ไข</a> / <a href="#" id="del<?php echo $row->id; ?>"><i class="icon-trash"></i>ลบ</a>

			  </td>
					
			</tr>
			
		<?php } ?>
		</tbody>

	</table>

	
</div>

